<!DOCTYPE html>
<html>
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
	<title>编辑话题表</title>
	<#include "/common/vue_resource.ftl">
</head>
<body>
<div id="app" v-cloak>
	<div class="ui-form">
		<form class="layui-form" @submit.prevent="submitForm()" method="post">
			<div class="layui-form-item">
				<label class="layui-form-label">主键<span class="ui-request">*</span></label>
				<div class="layui-input-block">
					<input type="text" v-model="record.id" placeholder="请输入主键" class="layui-input"/>
				</div>
			</div>
			<div class="layui-form-item">
				<label class="layui-form-label">话题分类表id<span class="ui-request">*</span></label>
				<div class="layui-input-block">
					<input type="text" v-model="record.categoryId" placeholder="请输入话题分类表id" class="layui-input"/>
				</div>
			</div>
			<div class="layui-form-item">
				<label class="layui-form-label">-<span class="ui-request">*</span></label>
				<div class="layui-input-block">
					<input type="text" v-model="record.name" placeholder="请输入-" class="layui-input"/>
				</div>
			</div>
			<div class="layui-form-item">
				<label class="layui-form-label">-<span class="ui-request">*</span></label>
				<div class="layui-input-block">
					<input type="text" v-model="record.startTime" placeholder="请输入-" class="layui-input"/>
				</div>
			</div>
			<div class="layui-form-item">
				<label class="layui-form-label">-<span class="ui-request">*</span></label>
				<div class="layui-input-block">
					<input type="text" v-model="record.endTime" placeholder="请输入-" class="layui-input"/>
				</div>
			</div>
			<div class="layui-form-item">
				<label class="layui-form-label">参与人数<span class="ui-request">*</span></label>
				<div class="layui-input-block">
					<input type="text" v-model="record.attendCount" placeholder="请输入参与人数" class="layui-input"/>
				</div>
			</div>
			<div class="layui-form-item">
				<label class="layui-form-label">-<span class="ui-request">*</span></label>
				<div class="layui-input-block">
					<input type="text" v-model="record.readCount" placeholder="请输入-" class="layui-input"/>
				</div>
			</div>
			<div class="layui-form-item">
				<label class="layui-form-label">奖品名称<span class="ui-request">*</span></label>
				<div class="layui-input-block">
					<input type="text" v-model="record.awardName" placeholder="请输入奖品名称" class="layui-input"/>
				</div>
			</div>
			<div class="layui-form-item">
				<label class="layui-form-label">参与方式<span class="ui-request">*</span></label>
				<div class="layui-input-block">
					<input type="text" v-model="record.attendType" placeholder="请输入参与方式" class="layui-input"/>
				</div>
			</div>
			<div class="layui-form-item">
				<label class="layui-form-label">是否删除(1是，2否)<span class="ui-request">*</span></label>
				<div class="layui-input-block">
					<input type="text" v-model="record.isDel" placeholder="请输入是否删除(1是，2否)" class="layui-input"/>
				</div>
			</div>
			<div class="layui-form-item">
				<label class="layui-form-label">创建人id<span class="ui-request">*</span></label>
				<div class="layui-input-block">
					<input type="text" v-model="record.createId" placeholder="请输入创建人id" class="layui-input"/>
				</div>
			</div>
			<div class="layui-form-item">
				<label class="layui-form-label">创建时间<span class="ui-request">*</span></label>
				<div class="layui-input-block">
					<input type="text" v-model="record.createTime" placeholder="请输入创建时间" class="layui-input"/>
				</div>
			</div>
			<div class="layui-form-item">
				<label class="layui-form-label">修改人id<span class="ui-request">*</span></label>
				<div class="layui-input-block">
					<input type="text" v-model="record.modifyId" placeholder="请输入修改人id" class="layui-input"/>
				</div>
			</div>
			<div class="layui-form-item">
				<label class="layui-form-label">修改时间<span class="ui-request">*</span></label>
				<div class="layui-input-block">
					<input type="text" v-model="record.modifyTime" placeholder="请输入修改时间" class="layui-input"/>
				</div>
			</div>

			<div class="layui-form-item">
				<div class="layui-input-block">
					<input type="submit" value="保存" class="layui-btn" />
				</div>
			</div>
		</form>
	</div>
</div>
<script>
	var app = new Vue({
		el: '#app',
		data: {
			showTypes: false,
			record : {
				id:'${params.id!}',
				id:'',
				categoryId:'',
				name:'',
				startTime:'',
				endTime:'',
				attendCount:'',
				readCount:'',
				awardName:'',
				attendType:'',
				isDel:'',
				createId:'',
				createTime:'',
				modifyId:'',
				modifyTime:'',
			},
		},
		mounted: function () {
			this.init();
			this.loadData();
		},
		methods: {
			init:function(){
				var that = this;
				/*laydate.render({elem: '#beginDate', type:'datetime', done:function (value) {
						that.record.beginDate = value;
					}});*/

			},
			loadData: function () {
				if (!'${params.id!}') {
					return;
				}
				var that = this;
				$.http.post('${params.contextPath}/web/cmsTopic/query.json', {id: '${params.id!}'}).then(function (data) {
					if (!data.success) {
						$.message(data.message);
						return;
					}
					var item = data.data;
					for (var key in  that.record) {
						that.record[key] = item[key];
					}
				});
			},
			submitForm: function () {
				$.http.post('${params.contextPath}/web/cmsTopic/<#if (params.id)??>modify<#else>save</#if>.json', this.record).then(function (data) {
					if (!data.success) {
						$.message(data.message);
						return;
					}
					var alt = layer.alert(data.message || "操作成功", function () {
						parent.app.loadData();
						parent.layer.closeAll();
						layer.close(alt);
					});
				});
			},
		}
	});
</script>
</body>

</html>
